| Conditions | 2 |
| Total Lines | 19 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { QueryHandler } from '@nestjs/cqrs'; |
||
| 13 | |||
| 14 | public async execute({ schoolId }: GetShootingsBySchoolQuery): Promise<ShootingSummaryView[]> { |
||
| 15 | const shootingViews: ShootingSummaryView[] = []; |
||
| 16 | const shootings = await this.shootingRepository.findBySchool( |
||
| 17 | schoolId |
||
| 18 | ); |
||
| 19 | |||
| 20 | for (const shooting of shootings) { |
||
| 21 | shootingViews.push( |
||
| 22 | new ShootingSummaryView( |
||
| 23 | shooting.getId(), |
||
| 24 | shooting.getName(), |
||
| 25 | shooting.getStatus(), |
||
| 26 | shooting.getShootingDate() |
||
| 27 | ) |
||
| 28 | ); |
||
| 29 | } |
||
| 30 | |||
| 31 | return shootingViews; |
||
| 32 | } |
||
| 34 |